<?php

namespace Bliss\ParcBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Machine
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Bliss\ParcBundle\Entity\MachineRepository")
 */
class Machine
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="nom", type="string", length=255)
     */
    private $nom;

    /**
     * @var string
     *
     * @ORM\Column(name="ip", type="string", length=255)
     */
    private $ip;

    
    
    /**
     *
     * @ORM\ManyToOne(targetEntity="Bliss\ParcBundle\Entity\Salle", inversedBy="machines")
     */
    private $salle;
    

     /**
     *  
     * @ORM\OneToMany(targetEntity="Bliss\IncidentBundle\Entity\Incident", mappedBy="machine", cascade={"persist"})
     */
    private $incidents;
    
     /**
     *
     * @ORM\OneToMany(targetEntity="Bliss\ParcBundle\Entity\Composant", mappedBy="machine", cascade={"persist"})
     */
    private $composants;
    
    

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return Machine
     */
    public function setNom($nom)
    {
        $this->nom = $nom;
    
        return $this;
    }

    /**
     * Get nom
     *
     * @return string 
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set ip
     *
     * @param string $ip
     * @return Machine
     */
    public function setIp($ip)
    {
        $this->ip = $ip;
    
        return $this;
    }

    /**
     * Get ip
     *
     * @return string 
     */
    public function getIp()
    {
        return $this->ip;
    }
    
     public function getSalle()
    {
        return $this->salle;
    }

  
    public function setSalle($salle)
    {
        $this->salle = $salle;
    
        return $this;
    }
    
    public function getIncidents()
    {
        return $this->incidents;
    }
    
    public function addIncident(\Bliss\IncidentBundle\Entity\Incident $incident)
    {
        $this->incidents[] = $incident;
    }
    
    public function getComposants()
    {
        return $this->composants;
    }
    
    public function setComposants($composants)
    {
        $this->composants = $composants;
    }
    
    public function addComposant(\Bliss\ParcBundle\Entity\Composant $composant)
    {
        $this->composants[] = $composant;
    }
    
    public function removeComposant(\Bliss\ParcBundle\Entity\Composant $composant) {
        $this->composants->removeElement($composant);
    }
    
    public function __toString() {
        return $this->nom;
    }
}
